package com.dingyuhang.common;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
 * 说明：工具类
 *
 */
public class StringUtil {

    public static boolean isEmpty(String src){
        return !notEmpty(src);
    }

    public static boolean notEmpty(String src){
        return src != null && src.trim().length() > 0;
    }

    public static String encodingUrl(String url){
        try {
            return URLEncoder.encode(url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return url;
    }

    public static String decodingUrl(String url){
        try {
            return URLDecoder.decode(url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return url;
    }
}
